﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using KPIS.GERP.GHRMS.BLL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.APP.Classes;

namespace KPIS.GERP.GHRMS.APP.App_UI.UserControls
{
    public partial class MP_JobsiteCommandDtls_Hierarchy : System.Web.UI.UserControl
    {
        IJobsiteCommandDtlsBLL oop = new JobsiteCommandDtlsBLL();

        protected void Page_Load(object sender, EventArgs e)
        {
            LoadGrid();
        }

        private void LoadGrid()
        {
            //RadGrid1.DataSource = oop.SelectGrid(lblJobsiteCmdSeq.Text);
        }

        protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName == "DeleteAll")
            {
                GridItem[] items = RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem);
                if (items.Length > 0)
                {
                    ((GridCommandItem)items[0]).FireCommandEvent("DeleteSelected", "");
                }
                else
                {
                    RadGrid1.Items[0].FireCommandEvent("DeleteSelected", "");
                }
            }
            else if (e.CommandName == "Delete")
            {
                //string strPK = (e.Item as GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["job_site_cmd_dtls_seq"].ToString();
                //oop.Delete(strPK, Session["UserID"].ToString(), DateTime.Now);
            }

            LoadGrid();
        }
    }
}